﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLTV_Public;
using System.Data;

namespace QLTV_Data
{
   public class NhatKy_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("");
       }
       public DataTable TaoBang(string sql)
       {
           return kn.taobang(sql);
       }
       public int Insert(NhatKy_Public obj)
       {
           int Npara = 7;
           string[]name=new string[Npara];
           object[] value = new object[Npara];
           name[0]="@MaBanGhi";
           value[0] = obj.MaBanGhi;
           name[1] = "@HanhDong";
           value[1] = obj.HanhDong;
           name[2] = "@CotThayDoi";
           value[2] = obj.CotThayDoi;
           name[3] = "@GiaTriMoi";
           value[3] = obj.GiaTriMoi;
           name[4] = "@GiaTriCu";
           value[4] = obj.GiaTriCu;
           name[5] = "@NgayCapNhat";
           value[5] = obj.NgayCapNhat;
           name[6] = "@MaNhanVien";
           value[6] = obj.MaNhanVien;
           return kn.update("Insert_NhatKy",name,value,Npara);
       }
       public int Delete(NhatKy_Public obj)
       {
           int Npara = 1;
           string[] name = new string[Npara];
           object[] value = new object[Npara];
           name[0] = "@ID";
           value[0] = obj.ID;
           return kn.update("Delete_NhatKy",name,value,Npara);
       }
       public int Delete_All_NhatKy()
       {
           return kn.update("delete from NhatKy");
       }
    }
}
